package contextUtils

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"time"
)

func ErrorJSON(ctx *gin.Context, code int, errMsg string) {
	ctx.JSON(code, gin.H{"code": code, "msg": errMsg})
}

func OkJSON(ctx *gin.Context, data interface{}) {
	ctx.JSON(http.StatusOK, gin.H{
		"code": http.StatusOK,
		"time": time.Now().Format("2006-01-02 15:04:05"),
		"data": data,
	})
}
